import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { Result, Icon, Tools} from 'weaver-mobile';
const getLabel = Tools.getLabel;

@withRouter
@observer
export default class CRMResult extends Component {
    constructor(props) {
        super(props);
        this.state = {
            message: this.props.message,
            seconds: 3
        }
    }

    componentWillMount() {
        // this.interval = setInterval(() => this.tick(), 1000);
        this.props.history.replace('/enter')
    }

    tick = () => {
        const { seconds } = this.state;
        if (seconds > 1) {
            this.setState({
                seconds: seconds - 1
            })
        } else {
            clearInterval(this.interval);
            this.props.history.replace('/enter')
        }
    }
    
    render() {
        const { message, seconds } = this.state;
        return (
            <div>
                {/* <Result
                    img={<Icon type="cross-circle-o" className="crm_commerce_initFailedMsg" style={{ fill: '#F13642' }} />}
                    title=""
                    message={<p dangerouslySetInnerHTML={{ __html:message+"<br/>"+seconds+getLabel('501417', '秒后将为您跳至主页面') }}  />}
                /> */}
            </div>
        )
    }
    

}